package com.anolesoft.twelveFactory.planManagement.service.impl;

import com.anolesoft.twelveFactory.planManagement.entity.Equivalent;
import com.anolesoft.twelveFactory.planManagement.mapper.EquivalentMapper;
import com.anolesoft.twelveFactory.planManagement.service.EquivalentService;
import com.anolesoft.yr.util.PageData;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class EquivalentServiceImpl extends ServiceImpl<EquivalentMapper,Equivalent> implements EquivalentService {

    @Resource
    private EquivalentMapper equivalentMapper;

    @Override
    public PageData<List<Equivalent>> listEquivalent(Equivalent equivalent) {
        Page<Equivalent> page = new Page<Equivalent>(equivalent.getPageNo(), equivalent.getPageSize());
        List<Equivalent> listEquivalent=equivalentMapper.listEquivalent(equivalent,page);
        return new PageData<>(((int) page.getTotal()), listEquivalent);
    }
    @Override
    public Equivalent selectById(String objuid) {
        return this.equivalentMapper.selectById(objuid);
    }
}
